package com.hpradip.android.documentaryHub;

import java.util.List;

import com.hpradip.android.documentaryHub.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class StringsAdapter extends ArrayAdapter<String> {

	private List<String> items;
	private LayoutInflater inflater;

	public StringsAdapter(Context context, int textViewResourceId,
			List<String> objects) {
		super(context, textViewResourceId, objects);
		this.items = objects;
		this.inflater = LayoutInflater.from(context);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = convertView;
		if (v == null) {
			v = inflater.inflate(R.layout.list_item2, null);
		}
		String text = items.get(position);
		if (text == null)
			return v;

		TextView header = (TextView) v.findViewById(R.id.header);
		header.setText(text);
		return v;
	}
}
